<?php
if(!defined('ADMIN')){
	exit('Access Denied');
}

if($_POST['sub']!=''){

    $id=empty($_POST['id'])?0:(int)$_POST['id'];
	unset($_POST['id']);
	unset($_POST['sub']);
	$data=array('subject'=>$_POST['subject'],"content"=>trim($_POST["content"]),"groupid"=>trim($_POST["groupid"]),
    "inputtime"=>time(),
    "from_uid"=>$_SESSION['EZ_Admin']['id'],    
    "send_from_id"=>$_SESSION['EZ_Admin']['name']    
    );
    
    if(trim($_POST['subject'])==""){
        jumpajax('300','信息标题不能为空!','');
    }
    if(trim($_POST['content'])==""){
        jumpajax('300','信息内容不能为空!','');
    }
   
 	if($id==0){
        $id=$ezhand->insert("message_group",$data);     
		jumpajax('200','保存成功','','closeCurrent');
	}
	else{
		jumpajax('200','不能修改信息！','','closeCurrent');
	}
}
else{
	$id=empty($_GET['id'])?0:(int)$_GET['id'];
    
    if($id==0){
	    $row=array();
	}
    $usergroup=ez_get_cache("usergroup");
	
}
?>